package com.cubeofnine.sugar.service.element;

import java.util.List;
import java.util.Vector;

public class Field {
	private String name = "";
	private String type = "";
	private String label = "";
	private int required = -1;
	private List<NameValue> optionList = new Vector<NameValue>();
	private String defaultValue = "";

	public Field() {

	}

	public Field(String name, String type, String label, int required,
			List<NameValue> optionList, String defaultValue) {
		this.name = name;
		this.type = type;
		this.label = label;
		this.required = required;
		this.optionList = optionList;
		this.defaultValue = defaultValue;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public int getRequired() {
		return required;
	}

	public void setRequired(int required) {
		this.required = required;
	}

	public List<NameValue> getOptionList() {
		return optionList;
	}

	public void setOptionList(List<NameValue> optionList) {
		this.optionList = optionList;
	}

	public void addOption(NameValue value) {
		optionList.add(value);
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}

	@Override
	public String toString() {
		return "Field [name=" + name + ", type=" + type + ", label=" + label
				+ ", required=" + required + ", optionList=" + optionList
				+ ", defaultValue=" + defaultValue + "]";
	}
}
